//************************************************
// File Name: SecondViewController.h
// Team: Team Epsilon
// Date Created: 2009/06/18
// Purpose: The Level1 of the adventure mode. 
// Change History: 
//   * Mark, Date: 2009/06/18 Create File
//   * James, Date: 2009/06/20 Adding Controller
//   * Mark, Date: 2009/06/24 Adding timer
//   * Mark, Date: 2009/06/30 Adding Objects
//   * James, Date: 2009/07/01 Adding Comments
//   * James, Date: 2009/07/14 Adding variable to fix movement bugs
//   * Mark, Date: 2009/07/15 Movement bug fix
//   * JJ, Date: 2009/07/15 Movement buy fix
//   * James, Date: 2009/07/16 Adding comment
//************************************************

#import <UIKit/UIKit.h>


// What is going to show on the userinterface
@interface SecondViewController : UIViewController 
{
    UIAlertView *usageAlertView;
    BOOL showUsageAlert;

	// the timer
	IBOutlet UILabel *countdownLabel;
	IBOutlet UILabel *msgLabel;
	int iniSec;
	int score1;
	BOOL timeUP;
	BOOL gameIsPlaying;
	int alertFlag;
	NSTimer *timer;
	
	// players of the level
	//   more player will be added here
	IBOutlet UIImageView *water1;
	IBOutlet UIImageView *water2;
	IBOutlet UIImageView *fire1;
	IBOutlet UIImageView *fire2;
	IBOutlet UIImageView *grass1;
	
	//player start position
	IBOutlet UIImageView *water1_stpos;
	IBOutlet UIImageView *water2_stpos;
	IBOutlet UIImageView *fire1_stpos;
	IBOutlet UIImageView *fire2_stpos;
	IBOutlet UIImageView *grass1_stpos;	
	
	// initial positions;
	CGPoint water1_cord;
	CGPoint water2_cord;
	CGPoint fire1_cord;
	CGPoint fire2_cord;
	CGPoint grass1_cord;
	
	// last positions recorder;
	CGPoint last_water1_cord;
	CGPoint last_water2_cord;
	CGPoint last_fire1_cord;
	CGPoint last_fire2_cord;
	CGPoint last_grass1_cord;
	CGPoint offScreenPoint;
	
	//initial position for checking where it can be moved
	CGPoint water1_stpos_cord;
	CGPoint water2_stpos_cord;
	CGPoint fire1_stpos_cord;
	CGPoint fire2_stpos_cord;
	CGPoint grass1_stpos_cord;
	
	//current position of the element in the node
	CGPoint water1_curr_cord;
	CGPoint water2_curr_cord;
	CGPoint fire1_curr_cord;
	CGPoint fire2_curr_cord;
	CGPoint grass1_curr_cord;				
	
	// how many kills record
	int kills;
	
	// check if player wins the game
	BOOL isWin;
	
}

// Action for interface builder
// Action for login button
- (IBAction)loginx:(id)sender;

// Action for go to the next level
- (IBAction) nextlevel:(id)sender;

// Action for go to the previous level
- (IBAction) prevlevel:(id)sender;

// timer 
// set the initial time
-(void)setIniTime;

//update the time
-(void)updateLabel;

// do something after time's up
-(IBAction)doSomething:(id)sender;

// action for start the game
- (IBAction)startCount:(id)sender;

// timer initial time in miliseconds
@property int iniSec;

// score
@property int score1;

//boolean to check if time's up
@property BOOL timeUP;

// boolean to check if the game is still playing
@property BOOL gameIsPlaying;
// timer ends

// using the buildin popup window
@property (nonatomic, retain) UIAlertView *usageAlertView;

// show the buildin popup window
@property BOOL showUsageAlert;

// the flag for alert to show
@property int alertFlag;

@end
